package sg.edu.nus.iss.club;

import java.io.Serializable;

public class Facility implements Comparable <Facility>, Serializable {
	
	private String name;
	private String description;

	public Facility (String name) {
		this.name = name;
		this.description = null;
	}
	
	public Facility (String name, String description) {
		
		this.name = name;
		this.description = description;
	}
	
	public String toString() {
		String result = name;
		if (description != null) {
			result +=  " (" + description + ")";
		}
		return result;
	}
	
	public void show () {
		
		System.out.println(this.toString());
	}
	
	
	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getDescription() {
		return description;
	}


	public void setDescription(String description) {
		this.description = description;
	}
	
	public int compareTo ( Facility f2) {
		if (f2 == null) {
			return -1;
		}
		else  {
			return getName().compareTo(f2.getName());
		}
	}
	
	public boolean equals (Object f2) {
		if (f2 instanceof Facility){
	
			if (compareTo((Facility)f2) == 0){
				return true;
			}else {
				return false;
			}
		}else {
			return false;
		}
	}


}
